package com.wxit.algorithm.practice;

/**
 * 演示爆战问题ExplosiveStack
 * 计算 n 5 = 4 + 1 +2 +3 +5
 * 4 = 4 + 3 + 2 + 1
 */
public class ExplosiveStack {

    public static void main(String[] args) {
        int sum = sum(10000000);
        System.out.println(sum);
    }

    public static int sum(int n) {
        if (n == 1) {
            return 1;
        }
        return n + sum(n - 1);
    }
}
